<?php
/**
 * Created by PhpStorm.
 * User: ybzc
 * Date: 2017/8/28
 * Time: 16:14
 */

namespace backend\models;

use Yii;
use yii\base\Model;

class ImgsForm extends Model
{
    public $files;
    public $num = 1;

    public function scenarios()
    {
        return [
            'upload' => ['files'],
        ];
    }

    public function rules()
    {
        return [
            ['files', 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg', 'maxFiles' => $this->getNum()],
        ];
    }

    public function setNum($params)
    {
        $this->num = $params;
    }

    public function getNum()
    {
        return $this->num;
    }
}